home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / msdos / lynx / source / doslynx / src / turlvie5.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-25  |  2.3 KB  |  71 lines

  1. //    Copyright (c) 1993, University of Kansas, All Rights Reserved
  2. //
  3. //    Class:        TURLView
  4. //    Include File:    turlview.h
  5. //    Purpose:    Provide the view of a URL
  6. //    Remarks/Portability/Dependencies/Restrictions:
  7. //    Revision History:
  8. //        12-27-93    created
  9. //        02-02-94    Began a major revision to fully handle a
  10. //                multiple document interface with WWW, take
  11. //                over the formatting and drawing of the
  12. //                old gridtext functions of HText, and optimize
  13. //                memory usage, selecting anchors, the usage of
  14. //                HText's new image file.  See gridtext.
  15. //        02-09-94    Split all members into seperate files.
  16. //        03-29-94    Modified to now work with searchable indexes.
  17. #include"turlview.h"
  18. #include"trace.h"
  19.  
  20. extern "C"    {
  21. #include"htaccess.h"
  22. }; //    extern "C"
  23.  
  24. Boolean TURLView::loadURL(const char *cp_URL, const char *cp_Index)    {
  25. //    Purpose:    Load a URL into a TURLView object.
  26. //    Arguments:    cp_URL    The url to load.
  27. //    Return Value:    Boolean    True    URL loaded.
  28. //                False    URL not loaded.
  29. //    Remarks/Portability/Dependencies/Restrictions:
  30. //        cp_URL should never be passed in as a NULL or even empty
  31. //            string.
  32. //        All code calling this function that requires some type of
  33. //            dialog to query for a URL must provide that code
  34. //            before calling this function, or just provide a name.
  35. //        The global variable TURLV_current is vital to proper
  36. //            functionality with the WWW library.
  37. //    Revision History:
  38. //        12-30-93    created
  39. //        03-30-94    Will notify user in this function if unable
  40. //                to load a particular document.
  41.  
  42.     auto BOOL B_HTLAResult = TRUE;
  43.  
  44.     //    Reset the limits of the view.
  45.     delta.y = delta.x = limit.y = limit.x = 0;
  46.  
  47.     //    This will load the url.
  48.     //    Check to see if we should perform a search or just load.
  49.     if(cp_Index == NULL)    {
  50.         B_HTLAResult = ::HTLoadAbsolute(cp_URL);
  51.     }
  52.     else    {
  53.         //    HTSearch must be used since we can have a different
  54.         //    index server than the url states.
  55.         B_HTLAResult = ::HTSearch(cp_Index, (HTParentAnchor *)
  56.             HTAnchor_findAddress(cp_URL));
  57.     }
  58.  
  59.     //    If the result is not good, then put a message out to the
  60.     //    user indicating such.
  61.     if(B_HTLAResult != TRUE)    {
  62.         doslynxmessage("Unable to load " << cp_URL);
  63.     }
  64. #ifndef RELEASE
  65.     trace("loadURL returning " << (B_HTLAResult == TRUE ? "true." :
  66.         "false."));
  67. #endif // RELEASE
  68.  
  69.     return(B_HTLAResult == TRUE ? True : False);
  70. }
  71.